<template>
  <a-card :bordered='false'>
    <div style='display: flex; justify-content: space-between'>
      <!-- 操作按钮区域 -->
      <div class='table-operator'>
        <!-- <a-button @click="handleAdd" type="primary" icon="plus" v-has="'serverInfo:add'">新增</a-button> -->
        <!-- <a-button type="primary" icon="download" @click="handleExportXls('服务表')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
        @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload> -->
        <a-dropdown v-if='selectedRowKeys.length > 0'>
          <a-menu slot='overlay'>
            <a-menu-item key='1' @click='batchDel'
            >
              <a-icon type='delete' v-has="'serverInfo:delete'" />
              删除
            </a-menu-item
            >
          </a-menu>
          <a-button style='margin-left: 8px'> 批量操作
            <a-icon type='down' />
          </a-button>
        </a-dropdown>
      </div>
      <!-- 查询区域 -->
      <div class='table-page-search-wrapper' style='display: flex; justify-content: end'>
        <a-form layout='inline' @keyup.enter.native='searchQuery'>
          <a-row :gutter='24'>
            <a-col :xl='6' :lg='7' :md='8' :sm='24' v-has="'cityServicestatistics:select'">
              <a-form-item label='城市服务商' style='margin-right: 10px'>
                <serveSelect @selectClick='selectClick' :value='queryParam.agencyCode'></serveSelect>
              </a-form-item>
            </a-col>
            <a-col :xl='6' :lg='7' :md='8' :sm='24'>
              <a-form-item label='开始时间'>
                <a-month-picker v-model='queryParam.startTime' @change='startChange' />
              </a-form-item>
            </a-col>
            <a-col :xl='6' :lg='7' :md='8' :sm='24'>
              <a-form-item label='结束时间'>
                <a-month-picker v-model='queryParam.endTime' @change='endChange' />
              </a-form-item>
            </a-col>
            <a-col :xl='6' :lg='7' :md='8' :sm='24'>
              <span style='float: left; overflow: hidden' class='table-page-search-submitButtons'>
                <a-button type='primary' @click='searchQuery' icon='search'>查询</a-button>
                <a-button type='primary' @click='searchReset' icon='reload' style='margin: 0 8px'>重置</a-button>
                <a-button v-has="'statisticMonthCoachWithdraw:export'" type='primary' icon='download' @click="handleExportXls('服务表')">导出</a-button>
              </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
    </div>
    <div class='ant-alert ant-alert-info' style='margin-bottom: 15px'>
      <span style='margin-right: 20px'
      >总实际提现=<span style='font-size: 16px; color: red'>(总提现金额-总扣费金额) </span
      ></span
      >
    </div>
<!--    <div class='ant-alert ant-alert-info' style='margin-bottom: 15px'>-->
<!--      <span style='margin-right: 20px'>参数说明-->
<!--      <span style='font-size: 16px; color: #f501fd'>-->
<!--        总营业额:(微信支付项目+支付宝支付项目+充值余额支付项目) -&#45;&#45; 实际营业额:(微信支付项目+支付宝支付项目)-->
<!--      </span >-->
<!--      </span>-->
<!--    </div>-->
    <!-- table区域-begin -->
    <div>
      <a-table
        ref='table'
        size='middle'
        bordered
        rowKey='1'
        :columns='columns'
        :dataSource='dataSource'
        :pagination='false'
        :loading='loading'
        class='j-table-force-nowrap'
        @change='handleTableChange'
        autoHeight
      >
      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <!-- <xhdjServerInfo-modal ref="modalForm" @ok="modalFormOk"></xhdjServerInfo-modal> -->
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import { getFileAccessHttpUrl, getAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import serveSelect from '@/components/serveSelect.vue'

export default {
  name: 'xhdjStatisticAnalysisCityServiceList',
  mixins: [JeecgListMixin],
  components: {
    serveSelect
  },
  data() {
    return {
      description: '技师提现分析报表',
      // 表头
      columns: [
        {
          title: '时间',
          align: 'center',
          dataIndex: 'time'
        },
        {
          title: '提现服务费',
          align: 'center',
          dataIndex: 'serviceAmount'
        },
        {
          title: '实际提现服务费',
          align: 'center',
          dataIndex: 'serviceActualAmount'
        },

        {
          title: '提现车费',
          align: 'center',
          dataIndex: 'fareAmount'
        },
        {
          title: '实际提现车费',
          align: 'center',
          dataIndex: 'fareActualAmount'
        },
        {
          title: '提现佣金',
          align: 'center',
          dataIndex: 'commissionAmount'
        },
        {
          title: '实际提现佣金',
          align: 'center',
          dataIndex: 'commissionActualAmount'
        },
        {
          title: '总扣费金额',
          align: 'center',
          dataIndex: 'deductMoney'
        },
        {
          title: '总提现金额',
          align: 'center',
          dataIndex: 'totalAmount'
        },
        {
          title: '总实际提现金额',
          align: 'center',
          dataIndex: 'totalActualAmount'
        },
        {
          title: '车费提现笔数',
          align: 'center',
          dataIndex: 'fareCount'
        },
        {
          title: '服务提现笔数',
          align: 'center',
          dataIndex: 'serviceCount'
        },
        {
          title: '佣金提现笔数',
          align: 'center',
          dataIndex: 'commissionCount'
        },
      ],
      url: {
        list: '/finance/sysxhdjFundsLog/monthCoachWithdrawList',
        delete: '/xhdjServerInfo/delete',
        deleteBatch: '/deleteBatch',
        exportXlsUrl: '/finance/sysxhdjFundsLog/monthCoachWithdrawListExport',
        importExcelUrl: 'xhdjServerInfo/importExcel',
        init: '/finance/sysxhdjFundsLog/statisticsMonth'
      }
    }
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },

  methods: {
    getAvatarView: function(avatar) {
      return getFileAccessHttpUrl(avatar)
    },
    startChange(date, dateString) {
      this.queryParam.startTime = dateString + '-01'
    },
    endChange(date, dateString) {
      this.queryParam.endTime = dateString + '-01'
    },
    selectClick(value) {
      this.queryParam.agencyCode = value
      this.searchQuery()
    }
    // init () {
    //   getAction(this.url.init, this.queryParam).then(res => {
    //     if (res.code == 200) {
    //       res.result.map(res => {
    //         res.time = '合计'
    //       })
    //       this.dataSource.push(...res.result)
    //     }
    //   })
    // }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
